package org.ricks.condition2.test;

import org.ricks.condition2.Condition;
import org.ricks.condition2.ConditionBinder;
import org.ricks.condition2.ConditionManager;

public class AchievementSystem {
    public void unlockAchievement(String playerId, String achievementId) {
        ConditionConfig config = loadAchievementCondition(achievementId);
        Condition condition = ConditionParser.parseCondition(playerId, config);
        ConditionManager.ME().register(condition);

        // 绑定完成回调
        ConditionBinder.getInstance().bind(condition, (pId, cond) -> {
            grantAchievementReward(pId, achievementId);
        });
    }

    private ConditionConfig loadAchievementCondition(String achievementId) {
        return new ConditionConfig();
    }

    private void grantAchievementReward(String pId, String achievementId) {
        System.err.println("成就条件完成， 发送成就奖励 ！");
    }
}